package com.attendance.controller;

import com.attendance.common.CommonPage;
import com.attendance.common.CommonResult;
import com.attendance.pojo.Pages;
import com.attendance.pojo.Teacher;
import com.attendance.service.TeacherService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by WYH on 2022/4/16 15:11
 */
@RestController
@RequestMapping("/teacher")
public class TeacherController {

    @Autowired
    private TeacherService teacherService;


    //    根据条件查询教师信息
    @GetMapping("/selectTeacher")
    public CommonResult selectTeacher(Teacher teacher,Pages pages) {
        return teacherService.selectTeacher(teacher,pages);
    }


    //    新增教师信息
    @PostMapping
    public CommonResult addTeacher(@RequestBody Teacher teacher) {
        return teacherService.addTeacher(teacher);
    }


    //    修改数据
    @PutMapping
    public CommonResult update(@RequestBody Teacher teacher) {
        return teacherService.updateTeacher(teacher);
    }


    //    修改状态
    @PutMapping("{id}")
    public CommonResult modifyStatus(@PathVariable String id){
        return teacherService.modifyStatus(id);
    }
}
